<template>
	<view>
		<u-loading-page icon-size="40" :loading="loading" loading-text="资源下载中..."></u-loading-page>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				loading: true,
			}
		},

		onShow() {
			// uni.redirectTo({
			// 	url: '/pages/mine/downs2'
			// })
			console.log('下载页面000');
			if (uni.getStorageSync('objurl')) {
				let objurl = uni.getStorageSync('objurl');
				uni.downloadFile({
					url: objurl, //仅为示例，并非真实的资源
					success: (res) => {
						if (res.statusCode === 200) {
							var durls = res.tempFilePath;
							console.log('下载成功', durls);
							uni.saveFile({
								tempFilePath: durls,
								success: function(res) {
									var savedFilePath = res.savedFilePath;
									console.log('baocun', savedFilePath);
									setTimeout(function() {
										uni.showModal({
											title: '提示',
											content: '下载成功！',
											showCancel: false,
											success() {
												uni.switchTab({
													url: '/pages/3d/index',
												})
												uni.removeStorage({
													key: 'objurl'
												})
											}
										})
									}, 1000)
								}
							});
						}
					}
				});
			}

		},
		methods: {

		}
	}
</script>

<style lang="scss">
	page {
		background: #f8f8f8;
	}

	.listBox {
		.list {
			// padding: 0 20rpx;
			margin: 25rpx 25rpx 0;
			border-radius: 10rpx;
			background: #fff;
			overflow: hidden;

			.Lcont {
				padding: 20rpx;
				line-height: 60rpx;
				font-size: 26rpx;

				.title {}

				.conts {
					color: #666;
				}
			}

			.Ltop {
				background-image: linear-gradient(to bottom right, #e5e5e5, #f4f4f4);
				line-height: 60rpx;
				padding: 0 20rpx;

				.s1 {
					color: #302C29;
				}

				.s2 {
					color: #0055ff;
				}

				.stutic {
					font-size: 24rpx;
					text-align: right;
				}

				.no {
					font-size: 24rpx;
					font-weight: bold;
				}
			}
		}
	}

	.tab {
		text-align: center;
		line-height: 80rpx;
		border-bottom: 1rpx solid #eee;
	}

	.tabck {
		color: #302C29;
		font-weight: bold;
		// border-bottom: 4rpx solid #302C29 !important;
		position: relative;
	}

	.tabck::after {
		content: ''; // 必须
		position: absolute;
		left: -50rpx;
		margin-left: 50%;
		bottom: 0;
		right: 0;
		width: 100rpx;
		height: 4px;
		border-radius: 10rpx;
		background-color: #302C29;
	}
</style>